//
//  MyContactListener.h
//  Demo
//
//  Created by CG on 13-10-8.
//
//

#ifndef Demo_MyContactListener_h
#define Demo_MyContactListener_h

#include "cocos2d.h"
#include "Box2d.h"
#include "BaseObject.h"
#include "Ball.h"
#include "Obstacle.h"
#include "Bucket.h"

#include <list>
using namespace std;

class MyContact
{
public:
    b2Fixture *fixtureA, *fixtureB;
    bool operator==(const MyContact& other) const
    {
        return (fixtureA == other.fixtureA) && (fixtureB == other.fixtureB);
    }
};


class MyContactListener : public b2ContactListener
{
    
public:
	virtual void BeginContact(b2Contact* contact);
	virtual void EndContact(b2Contact* contact);
	virtual void PreSolve(b2Contact* contact, const b2Manifold* oldManifold);
	virtual void PostSolve(b2Contact* contact, const b2ContactImpulse* impulse);
    
    void HandleCollision(MyContact& myContact);
    
    std::vector<MyContact>_contacts;
    
    MyContactListener();
    ~MyContactListener();
};


#endif
